package com.itheima.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.itheima.domain.User;
import com.itheima.mapper.UserMapper;
import com.itheima.service.UserService;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

  //注入Mapper接口
    @Autowired
    private UserMapper userMapper;

    @Override
    public User findByName(String name) {
        User user =new User();
        user.setName(name);
        user=userMapper.selectOne(user);
        return user;

    }

    @Override
    public User findById(int id) {
        return userMapper.selectByPrimaryKey(id);
    }
}